package cn.lanqiao.print;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Boos {
    public static void main(String[] args) {
        //创建对象
//        Printer printer = new Printer();
//        A4Paper a4Paper = new A4Paper();
//        BlackInk blackInk = new BlackInk();
        //设置关系
//        printer.setInk(blackInk);
//        printer.setPaper(a4Paper);


//        ApplicationContext ctx = new ClassPathXmlApplicationContext("spring.xml");
//        Printer printer = (Printer) ctx.getBean("printer");
        ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
        Printer printer = ctx.getBean(Printer.class);
//        //使用
        printer.print("测试一下！！！");
    }
}
